package com.myapp.struts;


import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import tpa.TablaPeriodica.TablaPeriodicaSessionRemote;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author leandro
 */
public class TablaPeriodicaBusinessDelegate {
    private static TablaPeriodicaBusinessDelegate _instance;
    public static TablaPeriodicaBusinessDelegate getInstance()
    {
        if(_instance == null)
            _instance = new TablaPeriodicaBusinessDelegate();

        return _instance;
    }
    private TablaPeriodicaBusinessDelegate()
    {
    }

    private TablaPeriodicaSessionRemote tablaPeriodicaSessionBean;
    private Context _initialContext;

    private Context getInitialContext() throws NamingException
    {
        if (_initialContext == null)
        {
            _initialContext = new InitialContext(System.getProperties());
        }

        return _initialContext;
    }

    public TablaPeriodicaSessionRemote getTablaPeriodicaSessionBean() throws NamingException
    {
        if (tablaPeriodicaSessionBean == null)
        {
            tablaPeriodicaSessionBean = (TablaPeriodicaSessionRemote) getInitialContext().lookup("TablaPeriodicaSessionBean");
        }

        return tablaPeriodicaSessionBean;
    }
}
